﻿using System;
using System.Collections.Generic;
using System.Linq;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Audio;
using Microsoft.Xna.Framework.Content;
using Microsoft.Xna.Framework.GamerServices;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Input;
using Microsoft.Xna.Framework.Media;

namespace FUSE
{
    public class DeathScreen : Microsoft.Xna.Framework.GameComponent
    {
        private KeyboardState playerInput;
        private Boolean hasSelected;
        private int playerSelection;

        private Texture2D backgroundTex;
        private Vector2 backgroundPOS;

        private Texture2D tryAgainButtonTex;
        private Texture2D tryAgainButtonHLTex;
        private Vector2 tryAgainButtonPOS;

        private Texture2D quitButtonTex;
        private Texture2D quitButtonHLTex;
        private Vector2 quitButtonPOS;

        public DeathScreen(Game game)
            : base(game)
        {
            // TODO: Construct any child components here
        }

        /// <summary>
        /// Allows the game component to perform any initialization it needs to before starting
        /// to run.  This is where it can query for any required services and load content.
        /// </summary>
        public override void Initialize()
        {
            // TODO: Add your initialization code here
            playerInput = new KeyboardState();
            hasSelected = false;
            playerSelection = 0; //default

            base.Initialize();
        }

        /// <summary>
        /// Allows the game component to update itself.
        /// </summary>
        /// <param name="gameTime">Provides a snapshot of timing values.</param>
        public override void Update(GameTime gameTime)
        {
            // TODO: Add your update code here
            while (!hasSelected)
            {
                if (playerInput.IsKeyDown(Keys.Up))
                {
                    incrementPlayerSelection();
                }
                else if (playerInput.IsKeyDown(Keys.Down))
                {
                    decrementPlayerSelection();
                }

                if (playerSelection == 0)
                {
                    //if choice 0 --> try again
                    //highlight tryAgain button
                }
                else if (playerSelection == 1)
                {
                    //if choice 1 --> options
                    //highlight options button
                }
                base.Update(gameTime);
            }
        }

        private void incrementPlayerSelection()
        {
            if (playerSelection == 0)
            {
                playerSelection = 1;
            }
        }

        private void decrementPlayerSelection()
        {
            if (playerSelection == 1)
            {
                playerSelection = 0;
            }
        }
    }
}
